package com.guli.mall.wms.controller;

import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;

import com.guli.mall.wms.entity.WareOrderTaskDetailEntity;
import com.guli.mall.wms.service.WareOrderTaskDetailService;
import com.guli.common.utils.PageUtils;
import com.guli.common.utils.R;


/**
 * 库存工作单
 *
 * @author 罗俊华
 * @email 1007052116@qq.com
 * @date 2020-09-29 21:37:28
 */
@RestController
@RequestMapping("wms/wareordertaskdetail")
public class WareOrderTaskDetailController {
    @Autowired
    private WareOrderTaskDetailService wareOrderTaskDetailService;


    @GetMapping("/list/{currentPage}/{size}")
    @ApiOperation("根据当前页和每页显示的记录数来获取wareOrderTaskDetail分页列表")
    public R list(@PathVariable("currentPage") Integer currentPage, @PathVariable("size") Integer size) {
        PageUtils<WareOrderTaskDetailEntity> page = wareOrderTaskDetailService.queryPage(currentPage,size);

        return R.ok().put("page", page);
    }



    @GetMapping("/info/{id}")
    @ApiOperation("根据id获取WareOrderTaskDetail")
    public R info(@PathVariable("id") Long id) {
            WareOrderTaskDetailEntity wareOrderTaskDetail = wareOrderTaskDetailService.getById(id);

        return R.ok().put("wareOrderTaskDetail", wareOrderTaskDetail);
    }

    @PostMapping("/save")
    @ApiOperation("插入WareOrderTaskDetail")
    public R save(@RequestBody WareOrderTaskDetailEntity wareOrderTaskDetail) {
            wareOrderTaskDetailService.save(wareOrderTaskDetail);

        return R.ok();
    }

    @PostMapping("/update")
    @ApiOperation("根据id更新WareOrderTaskDetail")
    public R update(@RequestBody WareOrderTaskDetailEntity wareOrderTaskDetail) {
            wareOrderTaskDetailService.updateById(wareOrderTaskDetail);

        return R.ok();
    }

    @PutMapping("/deleteBatch")
    @ApiOperation("根据id批量删除WareOrderTaskDetail")
    public R delete(@RequestBody Long[] ids) {
            wareOrderTaskDetailService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
